<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>其他咨询工作--咨询款支付form</title>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <!--页面样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/style.css"/>
    <!--Layui-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--extended-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--公用样式JS-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/jquery.boot.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
    <script type="text/javascript" src="${re.contextPath}/pageoffice.js" id="po_js_main"></script>
</head>
<style>
    .windows {
        background-color: #f8f8f8;
    }
    .popUp {
        width: 90%;
    }
    .tableSelectBar>.layui-form input{
        display: none!important;
    }
    .tableSelectBar>.layui-form button{
        display: none!important;
    }
</style>

<body>
<div class="windows">
    <div class="popUp whitebg">
        <div class="popUpTitle ft24 bold">付款申请表</div>
        <div class="clearfix mt10">
            <span class="fl">SDZZ-QR141</span>
            <span class="fr">编号：FKSQ-${orderCode}</span>
        </div>
        <div class="popUpBox book">
            <form action="" class="layui-form addform">
                <div class="popUpBox acceptance">

                    <table>
                        <tr>
                            <td>项目名称</td>
                            <td>
                                <input type="hidden" name="spfPrjid" value="${spf_prjid}">
                                <input type="hidden" name="fileInd" value="${ind}">
                                <input type="hidden" name="spfStaid" value="${spf_staid}">
                                <input type="hidden" name="spfMilid" value="${spf_milid}">
                                <input type="hidden" name="projectName" value="${pdto.projectName}">
                                <input type="hidden" name="spfFilecode" value="${spfFilecode}">
                                <input type="hidden" name="bfcId" value="40011">
                                <input type="hidden" name="orderCode" value="${orderCode}">
                                <input type="hidden" name="fbCode" value="${fbCode}">
                                <input type="hidden" name="pcId" value="${pcId}">
                                <input type="hidden" name="wjNum" value="11">
                                <input type="text" name="spfF1" id="spfF1" value="${pdto.projectName}"
                                       lay-verify="spfF1" style="width: 100%;">
                            </td>

                        </tr>
                        <tr>
                            <td >日期</td>
                            <td >
                                <input type="text" placeholder="选择时间"  autocomplete="off" name="spfF2" id="spfF2"
                                       lay-verify="spfF9"></td>
                        </tr>
                        <tr>
                            <td>业主方</td>
                            <td><input type="text" name="spfF3" lay-verify="spfF3"
                                       value="${pdto.owerCompany}"></td>
                        </tr>
                        <tr>
                            <td>咨询方</td>
                            <td><input type="text" name="spfF4" lay-verify="spfF4"
                                       value="${pdto.supervisorCompanyName}"></td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <textarea name="spfF5" lay-verify="spfF5">致:${pdto.owerCompany}

  我方已完成_______________________工作，按编号为_____________合同的规定，业主方应在__________阶段，支付该项目合同总额______%的工程款（大写）________（小写：________)，
现报上项目付款申请表，请予以审查。
附件：
     付款条件证明。
账户信息：
  名称：
  地址：
  电话：
  开户行：
  账号：

                                </textarea>
                            </td>
                        </tr>
                        <tr>
                            <td>咨询方负责人：</td>
                            <td>
                                <input type="text"  name="spfF6"  lay-verify="spfF6" vtext="咨询方负责人不能为空" style="width: 30%;" >
                            </td>
                        </tr>
                        <tr>
                            <td>日期：</td>
                            <td>
                                <input type="text"  id="spfF7" name="spfF7"  lay-verify="spfF7" style="width: 20%;" class="bor0" >
                            </td>
                        </tr>
                        <tr>
                            <td>业主方批复意见：</td>
                            <td>
                                <textarea  name="spfF8"  lay-verify="spfF8" vtext="业主方批复意见不能为空" style="width: 100%;"onkeyup="javascript:setShowLength(this,'yzf')"></textarea>
                                <span class="abs limitfont"
                                      style="color: #ccc;float:left;margin-left: 3%;"
                                      id="yzf">已输入0/5000</span>
                            </td>
                        </tr>
                        <tr>
                            <td>日期：</td>
                            <td>
                                <input type="text"  id="spfF9" name="spfF9"  lay-verify="spfF9" style="width: 20%;" class="bor0" >
                            </td>
                        </tr>
                    </table>
                </div>

                <div>
                    <h2  style="margin-top: 20px;margin-bottom: 10px;">咨询款支付</h2>
                    <div  style="float: left">
                        <label class="layui-form-label">支付次数</label>
                        <div class="layui-input-block"  style="width: 190px;">
                            <select name="zfcs"id = "zfcs" lay-search  lay-verify="zfcs" vtext="支付次数不能为空">
                                <option value="">请选择支付次数</option>
                                <#list listpay as vo>
                                    <option value="${vo.sppId}">${vo.sppNo}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div  style="float: left">
                        <label class="layui-form-label">支付金额</label>
                        <div class="layui-input-inline">
                            <input type="text" name="zfje" id = "zfje"   lay-verify="zfje"  vtext="支付金额不能为空" placeholder="请输入支付金额" autocomplete="on" class="layui-input">
                        </div>
                    </div>
                    <div  style="float: left">
                        <label class="layui-form-label">发票金额</label>
                        <div class="layui-input-inline">
                            <input type="text" name="fpje" id = "fpje"   lay-verify="fpje" vtext="发票金额不能为空" placeholder="请输入发票金额" autocomplete="on" class="layui-input">
                        </div>
                    </div>


                </div>
                <div class="popUpBtn center"  style="clear: both;margin-bottom: 30px;">
                    <button type="button" class="blue bgnone close">关闭</button>
                    <button type="button" class="bluebg white" lay-submit lay-filter="submit">提交</button>
                </div>
            </form>
        </div>

    </div>
</div>
<!-- 公共配置第三方组件 -->
<script type="text/javascript">
    layui.config({
        version: false,
        debug: false,
        base: "${re.contextPath}/plugin/layui/lay/modules/"
    })
</script>

<script>
    var layer;
    var form;
    var laydate;
    var tableSelect;
    var upload;
    var uploadListIns;
    var htlistJson = '${htlistJson}';
    var htList ;
    var htCount = 0;
    var htObjList = [];
    var formAct;
    layui.use(['form', 'laydate', 'layer', 'upload','tableSelect'], function () {
        layer = layui.layer;
        form = layui.form;
        laydate = layui.laydate;
        upload = layui.upload;
        tableSelect = layui.tableSelect;
        // 日期
        laydate.render({
            elem: '#spfF2',
            value: new Date(),
            trigger: 'click',
            format: 'yyyy年MM月dd日'
        });
        laydate.render({
            elem: '#spfF7',
            trigger: 'click',
            format: 'yyyy年MM月dd日'
        });
        laydate.render({
            elem: '#spfF9',
            trigger: 'click',
            format: 'yyyy年MM月dd日'
        });
        // 表单校验
        /*$('form').initVerify(form);*/
        //监听提交

        form.on('submit(submit)', function (data) {
            reNameList(data);

            console.log(data.field);
            var reg =/(^[1-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{2}$)/;
            data.field.spfF40 = $("#zfcs").val();//支付次数
            var zfje =  $("#zfje").val();//支付金额
            if(!reg.test(zfje)){
                layer.msg("支付金额请填写最多2位小数的正整数", {icon: 2});
                return;
            }
            data.field.spfF41 =zfje;
            var fpje = $("#fpje").val();//发票金额
            if(!reg.test(fpje)){
                layer.msg("发票金额请填写最多2位小数的正整数", {icon: 2});
                return;
            }
            data.field.spfF42 = fpje;
            console.log(data.field);
            layerAjax('/zx/projectManager/addFormFile', data.field, '', function (d) {
                if (d.flag == true) {
                    var spfId = d.data.spfId;// fmid
                    var fpid = d.data.fpid;// fpid
                    POBrowser.openWindowModeless('/zx/office/openword?ft=2&fmid=' + spfId + '&fpid=' + fpid, 'width=1200px;height=800px;', '{}')
                } else {
                    layer.msg(d.msg, {icon: 2});
                }
            });
            return false;

        });

        $('.close').click(function () {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
        form.render();
    });
    function addStr(object) {
        var _tb = $("#tabledata").find("tbody");
        var _tr = _tb.find("tr:last").clone();
        var _tr_cnt = _tb.find("tr").length + 1;
        _tr.find("td:eq(0) input:eq(0) ").val(_tr_cnt);
        _tb.append("  <tr>\n" +
            "                                 <td  style=\"width: 10%; border: 1px solid #CCCCCC;\" align=\"center\">\n" +
            "                                     <input type=\"text\" class=\"fdata\" style=\"text-align:center;\" value=\""+_tr_cnt+"\"\n" +
            "                                            name=\"formDataList[0].data1\" iname=\"data1\">\n" +
            "                                     <input type=\"hidden\" class=\"fdata\" name=\"formDataList[0].tableRow\"\n" +
            "                                            iname=\"tableRow\" value=\"5\">\n" +
            "                                     <input type=\"hidden\" class=\"fdata\" name=\"formDataList[0].tableCos\"\n" +
            "                                            iname=\"tableCos\" value=\"3\">\n" +
            "                                     <input type=\"hidden\" class=\"fdata\" name=\"formDataList[0].tableIndex\"\n" +
            "                                            iname=\"tableIndex\" value=\"1\">\n" +
            "                                 </td>\n" +
            "                                 <td  style=\"width: 40%;border: 1px solid #CCCCCC;\" align=\"center\">\n" +
            "                                     <input type=\"text\" class=\"fdata\" name=\"formDataList[0].data2\"\n" +
            "                                            iname=\"data2\">\n" +
            "                                 </td>\n" +
            "                                 <td  style=\"width: 40%;border: 1px solid #CCCCCC;\" align=\"center\">\n" +
            "                                     <input type=\"text\" class=\"fdata\" name=\"formDataList[0].data3\"\n" +
            "                                            iname=\"data3\">\n" +
            "                                 </td>\n" +
            "                                     <td style=\"width: 10%;border: 1px solid #CCCCCC;\" align=\"center\">\n" +
            "                                         <img src=\"${re.contextPath}/plugin/common/images/19@2x.png\"\n" +
            "                                              style=\"width: 22px;padding:10px \" onclick=\"deleteStr(this)\" alt=\"\">\n" +
            "                                     </td>\n" +
            "                                </tr>");
    }

    // 删除
    function deleteStr(object) {
        $(object).parent().parent().remove();
    }
    function reNameList(d) {
        $("#tabledata").find("tbody").find("tr").each(function (i, v) {
            var _v_tr = $(v);
            _v_tr.find(".fdata").each(function (j, w) {
                var _v_input = $(w);
                d.field["formDataList[" + i + "]." + _v_input.attr("iname")]=_v_input.val();
            })
        })
    }
    function setShowLength(obj,id){
        var val = obj.value;
        val = val.replace(/\s+/g,"");
        var remain = val.length;
        if(remain>5000){
            $("#"+id).html( "已输入"+remain+"/5000").css("color","#FF0000");
            $("#"+id).removeClass("text-gray-6");
        }else{
            $("#"+id).html( "已输入"+remain+"/5000").css("color","#ccc");
            $("#"+id).addClass("text-gray-6");
        }
    }
</script>
</body>
</html>
